home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 60.zip / BS1 part 60 / Highspeed pascal.adf / Demos / Hello.pas < prev    next >
Pascal/Delphi Source File  |  1991-12-31  |  2KB  |  102 lines

  1. { The good old 'Hello World' program made in HighSpeed Pascal }
  2. { This is a translation of the RKM example and does it the hard
  3.   way of calling the operating system directly }
  4.   
  5. Program HelloWorld;
  6.  
  7. Uses Exec,Graphics,Intuition;
  8.  
  9.  
  10. type
  11.   tFont= record
  12.     font_name: pCString; {font_name}
  13.     font_no:   Integer;  {TOPAZ_SIXTY}
  14.     font_ddd1: ShortInt; {FS_NORMAL}
  15.     font_ddd2: ShortInt; {FPF_ROMFONT}
  16.   end;
  17.  
  18.  
  19. var
  20.   MyNewWindow: tNewWindow;
  21.   MyNewScreen: tNewScreen;
  22.  
  23.   FontName: CString;
  24.   Title:    CString;
  25.   WTitle:   CString;
  26.   MyFont:   tFont;
  27.  
  28.   MyScreen: pScreen;
  29.   MyWindow: pWindow;
  30.   L: Longint;
  31.  
  32. begin
  33.  
  34.   GfxBase:=pGfxBase(OpenLibrary('graphics.library',0));
  35.   IntuitionBase:=pIntuitionBase(OpenLibrary('intuition.library',0));
  36.  
  37.   with MyFont do begin
  38.     PasToC('Topaz.font',FontName); font_name:=@FontName;
  39.     font_no  :=TOPAZ_SIXTY;
  40.     font_ddd1:=FS_NORMAL;
  41.     font_ddd2:=FPF_ROMFONT;
  42.   end;
  43.  
  44.   with MyNewScreen do begin
  45.     LeftEdge:=0;
  46.     TopEdge:=0;
  47.     Width:=320;
  48.     Height:=200;
  49.     Depth:=2;
  50.     DetailPen:=0;
  51.     BlockPen:=1;
  52.     ViewModes:=0;
  53.     Type_:=CUSTOMSCREEN;
  54.     Font:=@MyFont;
  55.     PasToC('HighSpeed Pascal Screen',Title);
  56.     DefaultTitle:=@Title;
  57.     Gadgets:=NIL;
  58.     CustomBitMap:=NIL;
  59.   end;
  60.   MyScreen:=OpenScreen(@MyNewScreen);
  61.   if MyScreen=NIL then Halt(1);
  62.  
  63.   with MyNewWindow do begin
  64.     LeftEdge:=20;
  65.     TopEdge:=20;
  66.     Width:=300;
  67.     Height:=100;
  68.     DetailPen:=0;
  69.     BlockPen:=1;
  70.     PasToC('A Simple Window',WTitle); Title:=@WTitle;
  71.     Flags:=WINDOWCLOSE or SMART_REFRESH or
  72.            ACTIVATE or WINDOWSIZING or
  73.            WINDOWDRAG or WINDOWDEPTH;
  74.     IDCMPFlags:=CLOSEWINDOW_;
  75.     Type_:=CUSTOMSCREEN;
  76.     FirstGadget:=NIL;
  77.     CheckMark:=NIL;
  78.     Screen:=MyScreen;
  79.     BitMap:=NIL;
  80.     MinWidth:=100;
  81.     MinHeight:=25;
  82.     MaxWidth:=640;
  83.     MaxHeight:=200;
  84.   end;
  85.   MyWindow:=OpenWindow(@MyNewWindow);
  86.   if MyWindow=NIL then begin
  87.     CloseScreen(MyScreen);          {Remove the screen opened before}
  88.     halt(2);
  89.   end;
  90.  
  91.   with MyWindow^ do begin
  92.     Move_(RPort,20,20);
  93.     Text_(RPort,'Hello World',11);
  94.     L:=Wait(BitMask(UserPort^.MP_SIGBIT));
  95.   end;
  96.  
  97.   CloseWindow(MyWindow);
  98.   CloseScreen(MyScreen);
  99.   CloseLibrary(Pointer(IntuitionBase));
  100.   CloseLibrary(Pointer(GfxBase));
  101. end.
  102.